var LODOP = getLodop(),css;
$(function(){
	$("#print_button").click(function(){		
		print(false,$("body").html());
	});
	$.get("../static/print.css",function(data){
		css = data;
	});
});
function init(body){
	return $(body).find("#reportId").val();
}
function getStyle(){
    return "<style>"+css+"</style>";
}
function getBody(body){
	return "<body>"+body+"</body>";
}
function getOrient(){
	return $("#orient").val();
}
function getPageName(){
	return $("#PagSizeList").val();
}
function getPageWidth(){
	return $("#pageWidth").val();
}
function getPageHeight(){
	return $("#pageHeight").val();
}
function print(isCustom,html){
	LODOP.PRINT_INIT(init(html));
	if(isCustom){
		LODOP.SET_PRINT_PAGESIZE(getOrient(),getPageWidth(),getPageHeight(),getPageName());
	}
	LODOP.ADD_PRINT_HTM(10,10,"100%","100%",getStyle()+getBody(html));
	if(isCustom){
		LODOP.PRINT();
	}else{
		LODOP.PREVIEW();		
	}
}
function batchPrint(htmls){
	for(var i=0;i<htmls.length;i++){
		print(true,htmls[i]);
	}
}